package icu.shaoyayu.common.log.config;

import icu.shaoyayu.common.log.CustomLogLogger;
import icu.shaoyayu.common.log.appender.Appender;
import icu.shaoyayu.common.log.appender.ConsoleAppender;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * @author shaoyayu
 * @date 2022/2/10
 * @apiNote 配置全局的输入和输出
 *  配置一个默认的控制台输出器
 */
@Component
public class CustomLoggingContext {
    /**
     * 输出器列表
     */
    private List<Appender> appenderList = new ArrayList<>();

    @Bean
    public CustomLogLogger customLogLogger(){
        // 控制台输出
        appenderList.add(new ConsoleAppender());
        return new CustomLogLogger(appenderList);
    }

}
